import QtQuick 2.0

Item {
    property string title: "单选框"
    height: 40
    id: root
    width: title.length * 12 + 40
    property int fontsize: 17

    property bool checked: false

    signal released()

    Rectangle{
        x: 4
        y: 12
        height: 16
        width: 16
        radius: 8
        border.color: "#CCCCCC"
        Rectangle{
            anchors.fill: parent
            radius: 8
            color: "#1677FF"
            Rectangle{
                anchors.centerIn: parent
                color: "white"
                height: 8
                width: 8
                radius: 4
            }
            visible: checked
        }
    }
    Item{
        height: 40
        width: 40
        x: 24
        Text {
            font.pixelSize: fontsize
            anchors.centerIn: parent
            text: title
        }
    }
    MouseArea{
        height: 30
        width: root.width
        y: 5
        onReleased: {
            checked = true
            root.focus = true
            root.released()
        }
    }

}
